package mas.agents;

import mas.patternVisualization.VisGui;
import jade.core.Agent;
import jade.core.behaviours.CyclicBehaviour;
import jade.lang.acl.ACLMessage;

public class VisualizationAgent extends Agent{
	
	@Override
	protected void setup() {
		System.out.println("Visualization Agent Online.");
		
		final VisGui gui = new VisGui();
		
		addBehaviour(new CyclicBehaviour() {
			private boolean patternsDone = false;
			
			@Override
			public void action() {
				if (!patternsDone) {
					ACLMessage msg = myAgent.blockingReceive();	
					if (msg.getContent().equals(Ontology.PATTERNS_READY_MSG)) {
						patternsDone = true;
						refreshGui();				
					}				
				}
				else {
					refreshGui();
				}
			}

			private void refreshGui() {
				//gui.refresh();				
			}
		});
	}

}
